package controllers;

import hx.base.BaseController;
import hx.dto.ReturnData;
import models.User;
import org.apache.commons.lang.StringUtils;

import java.util.List;

/**
 * @author HX<titanrain@163.com>
 */
public class UserC extends BaseController {

    public static void test() {
        renderText("fffff");
    }

    public static void add(String userName) {
        if (StringUtils.isBlank(userName)) {
            renderJSON(new ReturnData(false, "userName is blank"));
        }
        new User(userName).save();
        renderJSON(new ReturnData());
    }

    public static void query() {
        User user = User.findById(1);
        renderJSON(user);
    }

}
